package com.streamsets.datacollector.model.etl;

import java.util.List;
import java.util.Map;

/**
 * 创建管道 值替换Stage Dto
 * @author wengzhonghui
 * @date 2020/4/2 11:26
 */
public class FieldValueReplacerConfigJson {

    /*替换为空值的列配置
     * 对应的配置文件为
     * [ {
          "fieldsToNull" : [ "/created_by" ]
        }, {
          "fieldsToNull" : [ "/updated_dt" ]
        } ]
     */
    private List<String> nullReplaceColumns;


    /* 当值为空时，替换为某个值的配置,key值说明：fields: 表示要替换的列，newValue：表示要替换的值
     * 示例：
     * [ {
          "fields" : [ "remark" ],
          "newValue" : "备注"
        }, {
          "fields" : [ "status" ],
          "newValue" : "2"
        } ]
     */
    private List<Map<String, String>> fieldsToReplaceIfNullConfigs;



    /*
       按条件替换某一列的值 的配置,key值说明：
            fields：要替换的列，本地需要转换，对应的是： fieldNames
            operator：比较公式（< : 小于, == ： 等于， > : 大于）  : 本地需要做转换，对应的是：LESS_THAN，EQUALS，GREATER_THAN
            comparisonValue： 比较的值
            replacementValue： 需要替换的值
     * 示例：
     * [ {
          "fieldNames" : [ "/role_type" ],
          "operator" : "LESS_THAN",
          "comparisonValue" : "0",
          "replacementValue" : "通用角色"
        }, {
          "fieldNames" : [ "/role_type" ],
          "operator" : "EQUALS",
          "comparisonValue" : "1",
          "replacementValue" : "机构角色"
        }, {
          "fieldNames" : [ "/sort_no" ],
          "operator" : "GREATER_THAN",
          "comparisonValue" : "1",
          "replacementValue" : "22"
        } ]
     */
    private List<Map<String, String>> fieldsToConditionallyReplaceConfigs;


    public List<String> getNullReplaceColumns() {
        return nullReplaceColumns;
    }

    public void setNullReplaceColumns(List<String> nullReplaceColumns) {
        this.nullReplaceColumns = nullReplaceColumns;
    }

    public List<Map<String, String>> getFieldsToReplaceIfNullConfigs() {
        return fieldsToReplaceIfNullConfigs;
    }

    public void setFieldsToReplaceIfNullConfigs(List<Map<String, String>> fieldsToReplaceIfNullConfigs) {
        this.fieldsToReplaceIfNullConfigs = fieldsToReplaceIfNullConfigs;
    }

    public List<Map<String, String>> getFieldsToConditionallyReplaceConfigs() {
        return fieldsToConditionallyReplaceConfigs;
    }

    public void setFieldsToConditionallyReplaceConfigs(List<Map<String, String>> fieldsToConditionallyReplaceConfigs) {
        this.fieldsToConditionallyReplaceConfigs = fieldsToConditionallyReplaceConfigs;
    }
}
